import java.io.*;

public class Main {
    public static void main(String[] args){
        final String fileName = "lesson9/task19/resource/data.txt";
//        write(fileName);
        run(fileName);
    }

    public static void run(String fileName) {
        try (
                DataInputStream dis = new DataInputStream(new FileInputStream(fileName));
        ) {
            System.out.println(dis.readUTF());
            System.out.println(dis.readUTF());
            System.out.println(dis.readInt());
            System.out.println(dis.readDouble());
            System.out.println(dis.readBoolean());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void write(String fileName) {
        try (final DataOutputStream dos = new DataOutputStream(new FileOutputStream(fileName))) {
            dos.writeUTF("");
            dos.writeInt(1);
            dos.writeDouble(1.2);
            dos.writeBoolean(true);
            // ...
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}